#include "GOTHclock.h"

void Clock_InitOsc(void){
	CLKDIVbits.RCDIV = 1;		// 4 MHz FRC postscaler output (to USB PLL)
	CLKDIVbits.CPDIV = 0;		// 32 system clock (USB PLL output)
	CLKDIVbits.DOZE = 0;		// CPU:Peripheral clock ratio = 1:1
	
	while(OSCCONbits.LOCK != 1); // wait until PLL is in lock
	
	// reference clock output for debugging
	REFOCON &= ~0x8000;
	REFOCONbits.RODIV = 0;
}
